using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace BizTalk.BuildGenerator.Tasks
{
    /// <summary>
    /// Gets the current date formatted appropriately
    /// </summary>
    public class GetDate : Task
    {        
        private string _Format;
        private string _Date;

        /// <summary>
        /// The outputted date
        /// </summary>
        [Output]
        public string Date
        {
            get { return _Date; }
            set { _Date = value; }
        }
        /// <summary>
        /// The required format
        /// </summary>
        [Required]
        public string Format
        {
            get { return _Format; }
            set { _Format = value; }
        }
        /// <summary>
        /// Executes the task
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            DateTime now = DateTime.Now;
            _Date = now.ToString(_Format, null);
            return true;
        }

    }

}


